import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:get/get.dart';

/**
 * Toast 封装
 */
class ToastUtil{
  static toast(String msg,{BuildContext context,int code}){
    Fluttertoast.showToast(
      msg: msg??'',
      toastLength: Toast.LENGTH_LONG,
      gravity: ToastGravity.TOP,
      timeInSecForIosWeb: 1,
      backgroundColor: Colors.grey,
      textColor: Colors.white,
      fontSize:15,
    );

  }
  static toastStatus(String msg,{BuildContext context,int code,bool isSuccess}){
    Fluttertoast.showToast(
      msg: msg??'',
      toastLength: Toast.LENGTH_LONG,
      gravity: ToastGravity.CENTER,
      timeInSecForIosWeb: 1,
      backgroundColor: Theme.of(Get.context).primaryColorLight,
      // textColor: (isSuccess??false)?ColorUtils.color_39be0b:ColorUtils.color_red,
      textColor: Colors.white,
      fontSize:15,
    );

  }
}